package gui.controller;

import gui.GuiCommands;
import gui.gui.Hauptmenue;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import Fiad.FIAD;

import valueobjects.Azubi.Azubi;

public class ControllerHauptmenue implements ActionListener, MouseListener {

	Hauptmenue refHa;
	ControllerAzubierstellung ca;
	ControllerAzubiaenderung caa;

	public ControllerHauptmenue(FIAD fiad) {
		this.refHa = new Hauptmenue(fiad);
		this.refHa.registerActionListenerForHauptmenueButtons(this);
		this.refHa.registerMouseListener(this);
		this.refHa.setVisible(true);
	}

	/**
	 * Fügt den Buttons eine Funktion hinzu!
	 */

	@Override
	public void actionPerformed(ActionEvent e) {
		GuiCommands guiCommand = GuiCommands.valueOf(e.getActionCommand());
		switch (guiCommand) {

		case HINZU:
			refHa.erstellung();
			break;
		case SUCHE:
			refHa.pressSucheButton();
			break;
		case LOESCHEN:
			refHa.loeschen();
			break;
		case REFRESH:
			refHa.refresh();
			break;
		default:
			throw new IllegalArgumentException(
					"Das Kommando kann nicht verarbeitet werden!");

		}

	}

	@Override
	public void mouseClicked(MouseEvent e) {
		if (e.getClickCount() == 2) {
			refHa.uebertragen();
		}

	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub

	}

}
